#include "rolling_checksum.h"

uint32_t MakeRollingChecksum(uint8_t *inData, size_t length)
{
    uint32_t s1 = 0;
    uint32_t s2 = 0;
    size_t i;

    for (i = 0; i < length; i++) {
        s1 += inData[i];
        s2 += s1;
    }

    return ((s2 & 0xFFFFU) << 16) | (s1 & 0xFFFFU);
}

